from pymysql import Connection

cono=Connection(
    host="localhost",
    port="3306",
    user="root",
    password="123456"
)
cono.select("数据库名")
cursor=cono.cursor()#获取游标对象
cursor.excute("sql")
cono.close()